package com.acme.task1;

/**
 * This class does arithmetic operation of two operands
 * 
 * @author Alexander Kotov
 */

public class Calculator {
	
	public Calculator() {
		super();
	}
	
	private static void printHelp(){
		System.out.format("Usage: %s <operand1> <operation> <operand2>%n"
				+ "<operation> = [+-*/]", Calculator.class.getName());
		
	}

	public static void main(String[] args) {
				
		if (args.length != 3) {
			printHelp();
			return;
		}
		
		double res = 0.0;
		double op1 = Double.parseDouble(args[0]);
        double op2 = Double.parseDouble(args[2]);
        
        switch (args[1]) {
        case "+":
            res = op1 + op2;
            break;
        case "-":
            res = op1 - op2;
            break;
        case "*":
            res = op1 * op2;
            break;
        case "/":
        	res = op1 / op2;
            break;
        default:
            printHelp();
            return;
        }
        
        System.out.println(res);
	}
}
